{{include file="header.tpl"}}
<div style="margin:20px auto;width:1000px;">
标题:{{$res.TITLE}} <br/>
金额:{{$res.PRICE_ALLOW}}元<br/>
年收益:{{$res.RATE}}%<br/>
期限：{{$res.REPAY_TIME}}个月<br/>
还款方式：{{$type_loan[$res.TYPE_LOAN]}}<br/>
最大投资限制：{{$res.MAX_LOAD}}元<br/>
剩余可投资金额:{{$res.surplus}}元<br/>
目前状态:{{$deal_stat[$res.DEAL_STAT]}}<br/>
进度： {{$res.loading}}%<br/>
{{if $user.USERNAME}}
用户余额:{{$usermoney.MONEY}}元<br/>
<form id="form1">
    <input type="hidden" name="id" value="{{$res.ID}}" />
    投标金额：<input type="text" name="money" id="money" />
    {{if $res.stime < 0}}
    <input type="button" name="btmsubmit" id="btmsubmit" value="投标" disabled="disabled" />
    {{else}}
    <input type="button" name="btmsubmit" id="btmsubmit" value="投标"/>
    {{/if}}
</form>
<script type="text/javascript">
$(function(){
  $('#btmsubmit').click(function(){
    if($('#money').val()!=""){
      var param = $('#form1').serialize();
      $.jBox.tip('正在处理...','loading');
      $.post("index.php?{{$TIN_CTL}}=deal&{{$TIN_ACT}}=dobid",param,function(res){
        if(res.code=='success'){
          $.jBox.tip("投资成功!");
          window.location.reload();
        }else{
          $.jBox.tip(res.msg);
        }
      },"json");      
    }else{
      $.jBox.alert('请填写投标的金额','');
    }
    return false;
  });
  $('#chkcode').click(function(){
    $(this).attr("src","res/vcode.php?rnd="+Math.random());
  });
});
</script>
{{else}}
用户余额:登录后可见<br/>
{{/if}}
开始时间:{{$res.CREATE_TIME}}<br/>
{{if $res.DEAL_STAT==1}}
剩余时间:{{$res.BAD_TIME}}<p id="time_0"></p><div style="DISPLAY: none" id="sec_left_0" class="time_left">{{$res.stime}}0</div>
{{/if}}
<br/>
<br/><br/>

内容:{{$res.CONTENT}}<br/>

</div>
<script type="text/javascript">
      var second =null; 
      var minite = null; 
      var hour = null; 
      var day = null; 
      var seconds = null;
      var sec = {};
      function getInitTime(){
          $('.time_left').each(function(){
             var jobj = $(this);
             var SysSecond = parseInt(jobj.text());
             var theid = parseInt((jobj.attr('id')).replace(/sec_left_/,''));
             sec[theid]= SysSecond;
          });
      }
      getInitTime();
      function SetRemainTime() {
            for(var i in sec){
                setRemainTimeSite(i,sec[i]);
            }
       }
      function setRemainTimeSite(theid,SysSs){
          seconds = SysSs/10;
          second = Math.floor(seconds % 60).toString();
          minite = Math.floor((seconds / 60) % 60).toString();
          hour = Math.floor((seconds / 3600) % 24).toString();
          day = Math.floor((seconds / 3600) / 24).toString();
          if (SysSs >= 0) {
               var ss = Math.floor(SysSs % 10).toString();
               if(SysSs % 10==0){
                  seconds = SysSs/10;
                  second = Math.floor(seconds % 60).toString();
                  minite = Math.floor((seconds / 60) % 60).toString();
                  hour = Math.floor((seconds / 3600) % 24).toString();
                  day = Math.floor((seconds / 3600) / 24).toString();
               }
               $("#time_"+theid).html(day + "天" + hour + "小时" + minite + "分" + second + "秒."+ss);
               sec[theid]--;
               SysSs--;
          }else{
            return;
          }
        }
      window.setInterval(SetRemainTime,100);
</script>
{{include file="footer.tpl"}}